package com.aimashi.railwaytoolmanagesystem.utils;


import android.content.Context;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.os.Vibrator;

import com.aimashi.railwaytoolmanagesystem.R;



/**
 * 提醒声音和提醒震�?<br>
 * <br>
 * CreateDate: 2013-8-30<br>
 * Copyright: Copyright(c) 2013-8-30<br>
 * <br>
 * 
 * @since v1.0.0
 * @Description 2013-8-30::::创建此类</br>
 */
public class ScanToolVoiceUtil {
	
	public static void callAlarmAsCustom(Context context,int pRawId){
		AudioManager audioManager = (AudioManager) context
				.getSystemService(Context.AUDIO_SERVICE); // 播放提示�?
		int max = audioManager.getStreamMaxVolume(AudioManager.STREAM_NOTIFICATION);
		int current = audioManager.getStreamVolume(AudioManager.STREAM_NOTIFICATION);
		MediaPlayer player = MediaPlayer.create(context, pRawId);
		player.setVolume((float) current / (float) max, (float) current/ (float) max); // 设置提示音量
		player.start();// 播放提示�?
		Vibrator vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE); // 振动100毫秒
		vibrator.vibrate(100); // 振动100毫秒
	}
	/**
	 * 领取扫描
	 * <br>
	 * 
	 * @param context
	 * @Description 2013-9-9::::创建此方�?/br>
	 */
	public static void callAlarmAsSearchScan(Context context) {
		AudioManager audioManager = (AudioManager) context
				.getSystemService(Context.AUDIO_SERVICE); // 播放提示�?
		int max = audioManager
				.getStreamMaxVolume(AudioManager.STREAM_NOTIFICATION);
		int current = audioManager
				.getStreamVolume(AudioManager.STREAM_NOTIFICATION);
		MediaPlayer player = MediaPlayer.create(context, R.raw.serchscan);
		player.setVolume((float) current / (float) max, (float) current
				/ (float) max); // 设置提示音量
		player.start();// 播放提示�?

		Vibrator vibrator = (Vibrator) context
				.getSystemService(Context.VIBRATOR_SERVICE); // 振动100毫秒
		vibrator.vibrate(100); // 振动100毫秒
	}

	/**
	 * 开始扫描<br>
	 * <br>
	 * 
	 * @param context
	 * @Description 2013-9-9::::创建此方�?/br>
	 */
	public static void callAlarmAsStartScan(Context context) {
		AudioManager audioManager = (AudioManager) context
				.getSystemService(Context.AUDIO_SERVICE); // 播放提示�?
		int max = audioManager
				.getStreamMaxVolume(AudioManager.STREAM_NOTIFICATION);
		int current = audioManager
				.getStreamVolume(AudioManager.STREAM_NOTIFICATION);
		MediaPlayer player = MediaPlayer.create(context, R.raw.startscan);
		player.setVolume((float) current / (float) max, (float) current
				/ (float) max); // 设置提示音量
		player.start();// 播放提示�?

		Vibrator vibrator = (Vibrator) context
				.getSystemService(Context.VIBRATOR_SERVICE); // 振动100毫秒
		vibrator.vibrate(100); // 振动100毫秒
	}

	/**
	 * 结束.<br>
	 * <br>
	 * 
	 * @param context
	 * @Description 2013-9-9::::创建此方�?/br>
	 */
	public static void callAlarmAsEndScan(Context context) {
		AudioManager audioManager = (AudioManager) context
				.getSystemService(Context.AUDIO_SERVICE); // 播放提示�?
		int max = audioManager
				.getStreamMaxVolume(AudioManager.STREAM_NOTIFICATION);
		int current = audioManager
				.getStreamVolume(AudioManager.STREAM_NOTIFICATION);
		MediaPlayer player = MediaPlayer.create(context, R.raw.endscan);
		player.setVolume((float) current / (float) max, (float) current
				/ (float) max); // 设置提示音量
		player.start();// 播放提示�?

		Vibrator vibrator = (Vibrator) context
				.getSystemService(Context.VIBRATOR_SERVICE); // 振动100毫秒
		vibrator.vibrate(100); // 振动100毫秒
	}
}
